package Day_06;

public class ExtendOneDemo {
    public static void main(String[] args) {
        int max1 = 0;
        float max2 = 0;
        double max3 = 0;
        long max4 = 0L;

        int[] max_1 = {1,2,3,4,5,6,7};
        float[] max_2 = {1,2,3,4,5,6,7};
        double[] max_3 = {1,2,3,4,5,6,7};
        long[] max_4 = {1,2,3,4,5,6,7};

        max1 = getMaxOfArray(max_1);
        max2 = getMaxOfArray(max_2);
        max3 = getMaxOfArray(max_3);
        max4 = getMaxOfArray(max_4);

        System.out.println("max1:"+max1);
        System.out.println("max2:"+max2);
        System.out.println("max3:"+max3);
        System.out.println("max4:"+max4);
    }

    public static int getMaxOfArray(int[] a){
        int max = a[0];
        for (int i = 1; i < a.length; i++) {
            if(max < a[i]){
                max = a[i];
            }
        }
        return max;
    }
    public static long getMaxOfArray(long[] a){
        long max = a[0];
        for (int i = 1; i < a.length; i++) {
            if(max < a[i]){
                max = a[i];
            }
        }
        return max;
    }
    public static double getMaxOfArray(double[] a){
        double max = a[0];
        for (int i = 1; i < a.length; i++) {
            if(max < a[i]){
                max = a[i];
            }
        }
        return max;
    }
    public static float getMaxOfArray(float[] a){
        float max = a[0];
        for (int i = 1; i < a.length; i++) {
            if(max < a[i]){
                max = a[i];
            }
        }
        return max;
    }
}
